﻿using System;
using NUnit.Framework;
using ScrumBox.Model;

namespace ScrumBox.UnitTests.Model
{
    [TestFixture]
    public class SprintBackLogItemTester
    {
        #region Setup/Teardown

        [SetUp]
        public void Setup()
        {
            var projectKey = "MyProject";
            var sprintTitle = "New Sprint";
            var sprintKey = string.Format("{0}-{1}", projectKey, sprintTitle);

            var startDate = DateTime.Now;
            var endDate = DateTime.Now + TimeSpan.FromDays(14);
            sprint = new Sprint(sprintKey, sprintTitle, startDate, endDate);
        }

        #endregion

        private Sprint sprint;


        /// <summary>
        /// Can add tasks to 
        /// </summary>
        [Test]
        public void CanCreateSprint()
        {
            var sprintBackLogItem = new SprintBackLogItem(sprint);
            var sprintBackLogTitle = "A new sprintbacklog item.";
            sprintBackLogItem.Title = sprintBackLogTitle;
            sprintBackLogItem.AddTask(new Task("create the stored procedures"));
            sprintBackLogItem.AddTask(new Task("create the ui"));
            sprintBackLogItem.AddTask(new Task("create the business services"));

            Assert.That(sprintBackLogItem.Title == sprintBackLogTitle);
            Assert.That(sprintBackLogItem.GetTasks().Count == 3);
            Assert.That(sprintBackLogItem.Sprint == sprint);
        }
    }
}